<?php
if( !defined('CORE') ) exit('Request Error!');

class ctl_result_setting extends common
{
    // 自动验证设置
    protected $_submit_validate     =   array(
        'r_title'=>array('','notempty','标题不能为空！','all'),
        'id'=>array('id','notempty','主键必须！','update'),
    );
    public function __construct()
    {
        $class_id = request('id');
        $this->_dbfield=array(
            'mainKey'=>'id',
            'allTableField'=>array('id'=>'编号','r_title'=>'标题','r_start_mark'=>'分数','r_end_mark'=>'至分数','r_result'=>'结果'),
            'addTableField'=>array('r_title','r_start_mark','r_end_mark','r_result'),
            'editTableField'=>array('id','r_title','r_start_mark','r_end_mark','r_result'),
            'listTableField'=>array('id','r_title','r_start_mark','r_end_mark','r_result'),
            'batchUpdateTableField'=>array(),
            'batchDeleteTableField'=>array(
                'mainKey'=>'id',
            ),
            'id'=>array(
                'element'=>array('e_name'=>'input','e_type'=>'text'),

            ),
            'r_title'=>array(
                'element'=>array('e_name'=>'input','e_type'=>'text'),
                'search'=>'1',
            ),
            'r_start_mark'=>array(
                'element'=>array('e_name'=>'input','e_type'=>'text'),

            ),
            'r_end_mark'=>array(
                'element'=>array('e_name'=>'input','e_type'=>'text'),

            ),
            'r_result'=>array(
                'element'=>array('e_name'=>'input','e_type'=>'text', 'richtext'=>true)
            )
        );

        parent::__construct();
        $this->table = 'class_paper_topic_result';
        $this->_allowAction = array(
            'add'=>array('title'=>'添加','type'=>'dialog','width'=>'500','height'=>'650','class_id'=>$class_id),
            'edit'=>array('title'=>'编辑','type'=>'href',),
            'delete'=>array('title'=>'删除','type'=>'href',),
            'batch_update'=>array('title'=>'批量修改','type'=>'href',),
        );
        tpl::assign('_allowAction',$this->_allowAction);
        tpl::assign('_submit_validate',$this->_submit_validate);
        tpl::assign('_dbfield',$this->_dbfield);
    }
    public function add(){
        $class_id = request('class_id');
        tpl::assign('class_id',$class_id);
        parent::add();
    }
}